package com.example.learn_android;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;


import androidx.annotation.Nullable;


public class ClickListener2 extends Activity implements View.OnClickListener {
    TextView text;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_click_listener2);
        Button btn = findViewById(R.id.clickListener2);

        text = findViewById(R.id.clickResult2);
        btn.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        if (v.getId() == R.id.clickListener2) {
            text.setText("点击后文字展示");
        }
    }
}